import QtQuick 2.0

Image {
    id: bg
    source: "qrc:/images/cardbg.png"
    y: isSelected ? startY - 50 : startY

    property bool isSelected: false
    property real startY: 0
    property string cardSrc: ""         //卡片素材
    property real cardId: 0             // 卡片id
    property real cardType: 0           // 卡片类型

    MouseArea{
        anchors.fill: parent
        hoverEnabled: true
        onEntered: {
            rectKuang.visible = true
        }
        onExited: {
            rectKuang.visible = false
        }
        onCanceled: {
            rectKuang.visible = false
        }

        onClicked: {
            isSelected = !isSelected
            selectCard(cardId, isSelected)
        }
    }

    Rectangle{
        id: rectKuang
        anchors.fill: parent
        color: "transparent"
        border.width: 2
        border.color: "red"
        visible: false
    }

    Behavior on y {
        NumberAnimation{ duration: 200; }
    }
}
